package com.bqtv.sport.adapter

import android.content.Context
import android.graphics.Color
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bqtv.sport.bean.ProvinceBean
import com.chad.library.adapter4.BaseQuickAdapter
import com.bqtv.sport.databinding.ItemHomeHotBinding
import com.bqtv.sport.databinding.ItemHomeTodayBinding
import com.bqtv.sport.databinding.ItemSelectCityBinding

class SelectCityAdapter :
    BaseQuickAdapter<ProvinceBean, SelectCityAdapter.VH>() {
    class VH(
        parent: ViewGroup,
        val binding: ItemSelectCityBinding = ItemSelectCityBinding.inflate(
            LayoutInflater.from(parent.context), parent, false
        ),
    ) : RecyclerView.ViewHolder(binding.root)

    public var checkPosition=0
    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): VH {
        // 返回一个 ViewHolder
        return VH(parent)
    }

    override fun onBindViewHolder(holder: VH, position: Int, item: ProvinceBean?) {
        // 设置item数据
        holder.binding.tvName.text=item?.name
        if (checkPosition==position){
            holder.binding.tvName.setTextColor(Color.parseColor("#03DB6C"))
        }else{
            holder.binding.tvName.setTextColor(Color.parseColor("#222222"))
        }
    }
}